package com.sdhs.projectschedule.controller;

import com.sdhs.common.annotation.Log;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.enums.BusinessType;
import com.sdhs.projectschedule.domain.GcProgressMasterPlan;
import com.sdhs.projectschedule.service.IGcProgressMasterPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 项目进度控制--总体计划管理Controller
 *
 * @author ww
 * @date 2025-03-22
 */
@RestController
@RequestMapping("/progress/masterPlan")
public class GcProgressMasterPlanController extends BaseController {
    @Autowired
    private IGcProgressMasterPlanService gcProgressMasterPlanService;

    /**
     * 查询总体计划列表
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlan:list')")
    @GetMapping("/list")
    public AjaxResult list(GcProgressMasterPlan gcProgressMasterPlan) {
        GcProgressMasterPlan masterPlan = gcProgressMasterPlanService.selectGcProgressMasterPlanTreeList(gcProgressMasterPlan);
        return success(masterPlan);
    }

    /**
     * 查询总体计划列表
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlan:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(gcProgressMasterPlanService.selectGcProgressMasterPlanById(id));
    }

    /**
     * 新增项目进度控制--总体计划管理
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlan:add')")
    @Log(title = "项目进度控制--总体计划管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult saveOrUpdate(@RequestBody GcProgressMasterPlan gcProgressMasterPlan) {
        return success(gcProgressMasterPlanService.saveOrUpdateGcProgressMasterPlan(gcProgressMasterPlan));
    }

}
